# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PrivateCA.V1.Model.PublishingOptions do
  @moduledoc """
  Options relating to the publication of each CertificateAuthority's CA certificate and CRLs and their inclusion as extensions in issued Certificates. The options set here apply to certificates issued by any CertificateAuthority in the CaPool.

  ## Attributes

  *   `encodingFormat` (*type:* `String.t`, *default:* `nil`) - Optional. Specifies the encoding format of each CertificateAuthority resource's CA certificate and CRLs. If this is omitted, CA certificates and CRLs will be published in PEM.
  *   `publishCaCert` (*type:* `boolean()`, *default:* `nil`) - Optional. When true, publishes each CertificateAuthority's CA certificate and includes its URL in the "Authority Information Access" X.509 extension in all issued Certificates. If this is false, the CA certificate will not be published and the corresponding X.509 extension will not be written in issued certificates.
  *   `publishCrl` (*type:* `boolean()`, *default:* `nil`) - Optional. When true, publishes each CertificateAuthority's CRL and includes its URL in the "CRL Distribution Points" X.509 extension in all issued Certificates. If this is false, CRLs will not be published and the corresponding X.509 extension will not be written in issued certificates. CRLs will expire 7 days from their creation. However, we will rebuild daily. CRLs are also rebuilt shortly after a certificate is revoked.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :encodingFormat => String.t() | nil,
          :publishCaCert => boolean() | nil,
          :publishCrl => boolean() | nil
        }

  field(:encodingFormat)
  field(:publishCaCert)
  field(:publishCrl)
end

defimpl Poison.Decoder, for: GoogleApi.PrivateCA.V1.Model.PublishingOptions do
  def decode(value, options) do
    GoogleApi.PrivateCA.V1.Model.PublishingOptions.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.PrivateCA.V1.Model.PublishingOptions do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
